/**
 * 
 */
package vn.com.demand.lux.view.labelprovider;

import vn.com.demand.lux.model.WarrantyExpenseAccrualBean;
import vn.com.demand.util.DpUtils;

/**
 * @author Huynh Tan Tai <httcntt@yahoo.com>
 *
 */
public class WarrantyExpenseAccrualCalculatorLabelProvider extends BasicLabelProvider {

	public String getColumnText(Object element, int columnIndex) {
		String numberFormat = "###,###,###,###.00";
		String formatVND = "###,###,###,###,###";
		Double value = null;
		WarrantyExpenseAccrualBean bean = (WarrantyExpenseAccrualBean)element;
		switch (columnIndex) {
		case 0:
			return DpUtils.format(bean.getDate());
		case 1:
			return bean.getDivision();
		case 2:
			return bean.getJournalCode();
		case 3:
			return "" + bean.getNumber();
		case 4:
			return bean.getType();
		case 5:
			return bean.getSubType();
		case 6:
			return bean.getLedger();
		case 7:
			return bean.getDescription();
		case 8:
			return bean.getCustomer();
		case 9:
			return bean.getResource();
		case 10:
			return bean.getYourReference();
		case 11:
			return bean.getCurrency();	
		case 12:
			value = bean.getExchangeRate();
			return value != null && value != 0.0? DpUtils.format(value, numberFormat) : "";
		case 13:
			value = bean.getDebitFC();
			return value != null && value != 0.0? DpUtils.format(value, numberFormat) : "";
		case 14:
			value = bean.getCreditFC();
			return value != null && value != 0.0? DpUtils.format(value, numberFormat) : "";
		case 15:
			value = bean.getDebitVND();
			return value != null && value != 0.0? DpUtils.format(value, formatVND) : "";
		case 16:
			value = bean.getCreditVND();
			return value != null && value != 0.0? DpUtils.format(value, formatVND) : "";
		case 17:
			return bean.getProjectCode();
		case 18:
			return bean.getCostCenter();
		default:
			break;
		}
		return "";
	}
}